load("@build_bazel_rules_android//android:rules.bzl", "android_library")

licenses(["notice"])

package(default_visibility = ["//visibility:public"])

java_library(
    name = "hybrid_decrypt_config",
    srcs = ["HybridDecryptConfig.java"],
    deps = [
        ":hybrid_config",
        "//src/main/java/com/google/crypto/tink:config",
    ],
)

java_library(
    name = "hybrid_encrypt_wrapper",
    srcs = ["HybridEncryptWrapper.java"],
    deps = [
        "//src/main/java/com/google/crypto/tink:hybrid_encrypt",
        "//src/main/java/com/google/crypto/tink:primitive_set",
        "//src/main/java/com/google/crypto/tink:primitive_wrapper",
        "//src/main/java/com/google/crypto/tink:registry",
        "//src/main/java/com/google/crypto/tink/subtle:bytes",
    ],
)

java_library(
    name = "hybrid_decrypt_wrapper",
    srcs = ["HybridDecryptWrapper.java"],
    deps = [
        "//src/main/java/com/google/crypto/tink:crypto_format",
        "//src/main/java/com/google/crypto/tink:hybrid_decrypt",
        "//src/main/java/com/google/crypto/tink:primitive_set",
        "//src/main/java/com/google/crypto/tink:primitive_wrapper",
        "//src/main/java/com/google/crypto/tink:registry",
    ],
)

java_library(
    name = "ecies_aead_hkdf_public_key_manager",
    srcs = ["EciesAeadHkdfPublicKeyManager.java"],
    deps = [
        ":hybrid_util",
        ":registry_ecies_aead_hkdf_dem_helper",
        "//proto:ecies_aead_hkdf_java_proto",
        "//proto:tink_java_proto",
        "//src/main/java/com/google/crypto/tink:hybrid_encrypt",
        "//src/main/java/com/google/crypto/tink:key_type_manager",
        "//src/main/java/com/google/crypto/tink/subtle:ecies_aead_hkdf_dem_helper",
        "//src/main/java/com/google/crypto/tink/subtle:ecies_aead_hkdf_hybrid_encrypt",
        "//src/main/java/com/google/crypto/tink/subtle:elliptic_curves",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

java_library(
    name = "registry_ecies_aead_hkdf_dem_helper",
    srcs = ["RegistryEciesAeadHkdfDemHelper.java"],
    deps = [
        "//proto:aes_ctr_hmac_aead_java_proto",
        "//proto:aes_ctr_java_proto",
        "//proto:aes_gcm_java_proto",
        "//proto:aes_siv_java_proto",
        "//proto:hmac_java_proto",
        "//proto:tink_java_proto",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:deterministic_aead",
        "//src/main/java/com/google/crypto/tink:registry",
        "//src/main/java/com/google/crypto/tink/aead:aead_config",
        "//src/main/java/com/google/crypto/tink/daead:deterministic_aead_config",
        "//src/main/java/com/google/crypto/tink/hybrid/subtle:aead_or_daead",
        "//src/main/java/com/google/crypto/tink/subtle:ecies_aead_hkdf_dem_helper",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

java_library(
    name = "hybrid_config",
    srcs = ["HybridConfig.java"],
    deps = [
        ":ecies_aead_hkdf_private_key_manager",
        ":ecies_aead_hkdf_public_key_manager",
        ":hybrid_decrypt_wrapper",
        ":hybrid_encrypt_wrapper",
        "//proto:config_java_proto",
        "//src/main/java/com/google/crypto/tink/aead:aead_config",
        "//src/main/java/com/google/crypto/tink/config:tink_fips",
        "//src/main/java/com/google/crypto/tink/hybrid/internal:hpke_private_key_manager",
    ],
)

java_library(
    name = "hybrid_key_templates",
    srcs = ["HybridKeyTemplates.java"],
    deps = [
        ":ecies_aead_hkdf_private_key_manager",
        "//proto:common_java_proto",
        "//proto:ecies_aead_hkdf_java_proto",
        "//proto:tink_java_proto",
        "//src/main/java/com/google/crypto/tink/aead:aead_key_templates",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

java_library(
    name = "ecies_aead_hkdf_private_key_manager",
    srcs = ["EciesAeadHkdfPrivateKeyManager.java"],
    deps = [
        ":ecies_aead_hkdf_public_key_manager",
        ":hybrid_util",
        ":registry_ecies_aead_hkdf_dem_helper",
        "//proto:common_java_proto",
        "//proto:ecies_aead_hkdf_java_proto",
        "//proto:tink_java_proto",
        "//src/main/java/com/google/crypto/tink:hybrid_decrypt",
        "//src/main/java/com/google/crypto/tink:key_template",
        "//src/main/java/com/google/crypto/tink:key_templates",
        "//src/main/java/com/google/crypto/tink:key_type_manager",
        "//src/main/java/com/google/crypto/tink:private_key_type_manager",
        "//src/main/java/com/google/crypto/tink:registry",
        "//src/main/java/com/google/crypto/tink/aead:aes_ctr_hmac_aead_key_manager",
        "//src/main/java/com/google/crypto/tink/aead:aes_gcm_key_manager",
        "//src/main/java/com/google/crypto/tink/subtle:ecies_aead_hkdf_dem_helper",
        "//src/main/java/com/google/crypto/tink/subtle:ecies_aead_hkdf_hybrid_decrypt",
        "//src/main/java/com/google/crypto/tink/subtle:elliptic_curves",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

java_library(
    name = "hybrid_util",
    srcs = ["HybridUtil.java"],
    deps = [
        "//proto:common_java_proto",
        "//proto:ecies_aead_hkdf_java_proto",
        "//src/main/java/com/google/crypto/tink:registry",
        "//src/main/java/com/google/crypto/tink/subtle:elliptic_curves",
    ],
)

java_library(
    name = "hybrid_decrypt_factory",
    srcs = ["HybridDecryptFactory.java"],
    deps = [
        ":hybrid_decrypt_wrapper",
        "//src/main/java/com/google/crypto/tink:hybrid_decrypt",
        "//src/main/java/com/google/crypto/tink:registry",
        "//src/main/java/com/google/crypto/tink:registry_cluster",
    ],
)

java_library(
    name = "hybrid_encrypt_factory",
    srcs = ["HybridEncryptFactory.java"],
    deps = [
        ":hybrid_encrypt_wrapper",
        "//src/main/java/com/google/crypto/tink:hybrid_encrypt",
        "//src/main/java/com/google/crypto/tink:registry",
        "//src/main/java/com/google/crypto/tink:registry_cluster",
    ],
)

java_library(
    name = "hybrid_encrypt_config",
    srcs = ["HybridEncryptConfig.java"],
    deps = [
        ":hybrid_config",
        "//src/main/java/com/google/crypto/tink:config",
    ],
)

# Android libraries

android_library(
    name = "hybrid_decrypt_config-android",
    srcs = ["HybridDecryptConfig.java"],
    deps = [
        ":hybrid_config-android",
        "//src/main/java/com/google/crypto/tink:config-android",
    ],
)

android_library(
    name = "hybrid_encrypt_wrapper-android",
    srcs = ["HybridEncryptWrapper.java"],
    deps = [
        "//src/main/java/com/google/crypto/tink:hybrid_encrypt",
        "//src/main/java/com/google/crypto/tink:primitive_set-android",
        "//src/main/java/com/google/crypto/tink:primitive_wrapper-android",
        "//src/main/java/com/google/crypto/tink:registry-android",
        "//src/main/java/com/google/crypto/tink/subtle:bytes",
    ],
)

android_library(
    name = "hybrid_decrypt_wrapper-android",
    srcs = ["HybridDecryptWrapper.java"],
    deps = [
        "//src/main/java/com/google/crypto/tink:crypto_format-android",
        "//src/main/java/com/google/crypto/tink:hybrid_decrypt",
        "//src/main/java/com/google/crypto/tink:primitive_set-android",
        "//src/main/java/com/google/crypto/tink:primitive_wrapper-android",
        "//src/main/java/com/google/crypto/tink:registry-android",
    ],
)

android_library(
    name = "ecies_aead_hkdf_public_key_manager-android",
    srcs = ["EciesAeadHkdfPublicKeyManager.java"],
    deps = [
        ":hybrid_util-android",
        ":registry_ecies_aead_hkdf_dem_helper-android",
        "//proto:ecies_aead_hkdf_java_proto_lite",
        "//proto:tink_java_proto_lite",
        "//src/main/java/com/google/crypto/tink:hybrid_encrypt",
        "//src/main/java/com/google/crypto/tink:key_type_manager-android",
        "//src/main/java/com/google/crypto/tink/subtle:ecies_aead_hkdf_dem_helper",
        "//src/main/java/com/google/crypto/tink/subtle:ecies_aead_hkdf_hybrid_encrypt",
        "//src/main/java/com/google/crypto/tink/subtle:elliptic_curves",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

android_library(
    name = "registry_ecies_aead_hkdf_dem_helper-android",
    srcs = ["RegistryEciesAeadHkdfDemHelper.java"],
    deps = [
        "//proto:aes_ctr_hmac_aead_java_proto_lite",
        "//proto:aes_ctr_java_proto_lite",
        "//proto:aes_gcm_java_proto_lite",
        "//proto:aes_siv_java_proto_lite",
        "//proto:hmac_java_proto_lite",
        "//proto:tink_java_proto_lite",
        "//src/main/java/com/google/crypto/tink:aead",
        "//src/main/java/com/google/crypto/tink:deterministic_aead",
        "//src/main/java/com/google/crypto/tink:registry-android",
        "//src/main/java/com/google/crypto/tink/aead:aead_config-android",
        "//src/main/java/com/google/crypto/tink/daead:deterministic_aead_config-android",
        "//src/main/java/com/google/crypto/tink/hybrid/subtle:aead_or_daead",
        "//src/main/java/com/google/crypto/tink/subtle:ecies_aead_hkdf_dem_helper",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

android_library(
    name = "hybrid_config-android",
    srcs = ["HybridConfig.java"],
    deps = [
        ":ecies_aead_hkdf_private_key_manager-android",
        ":ecies_aead_hkdf_public_key_manager-android",
        ":hybrid_decrypt_wrapper-android",
        ":hybrid_encrypt_wrapper-android",
        "//proto:config_java_proto_lite",
        "//src/main/java/com/google/crypto/tink/aead:aead_config-android",
        "//src/main/java/com/google/crypto/tink/config:tink_fips-android",
        "//src/main/java/com/google/crypto/tink/hybrid/internal:hpke_private_key_manager-android",
    ],
)

android_library(
    name = "hybrid_key_templates-android",
    srcs = ["HybridKeyTemplates.java"],
    deps = [
        ":ecies_aead_hkdf_private_key_manager-android",
        "//proto:common_java_proto_lite",
        "//proto:ecies_aead_hkdf_java_proto_lite",
        "//proto:tink_java_proto_lite",
        "//src/main/java/com/google/crypto/tink/aead:aead_key_templates-android",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

android_library(
    name = "ecies_aead_hkdf_private_key_manager-android",
    srcs = ["EciesAeadHkdfPrivateKeyManager.java"],
    deps = [
        ":ecies_aead_hkdf_public_key_manager-android",
        ":hybrid_util-android",
        ":registry_ecies_aead_hkdf_dem_helper-android",
        "//proto:common_java_proto_lite",
        "//proto:ecies_aead_hkdf_java_proto_lite",
        "//proto:tink_java_proto_lite",
        "//src/main/java/com/google/crypto/tink:hybrid_decrypt",
        "//src/main/java/com/google/crypto/tink:key_template-android",
        "//src/main/java/com/google/crypto/tink:key_templates-android",
        "//src/main/java/com/google/crypto/tink:key_type_manager-android",
        "//src/main/java/com/google/crypto/tink:private_key_type_manager-android",
        "//src/main/java/com/google/crypto/tink:registry-android",
        "//src/main/java/com/google/crypto/tink/aead:aes_ctr_hmac_aead_key_manager-android",
        "//src/main/java/com/google/crypto/tink/aead:aes_gcm_key_manager-android",
        "//src/main/java/com/google/crypto/tink/subtle:ecies_aead_hkdf_dem_helper",
        "//src/main/java/com/google/crypto/tink/subtle:ecies_aead_hkdf_hybrid_decrypt",
        "//src/main/java/com/google/crypto/tink/subtle:elliptic_curves",
        "//src/main/java/com/google/crypto/tink/subtle:validators",
        "@com_google_protobuf//:protobuf_javalite",
    ],
)

android_library(
    name = "hybrid_util-android",
    srcs = ["HybridUtil.java"],
    deps = [
        "//proto:common_java_proto_lite",
        "//proto:ecies_aead_hkdf_java_proto_lite",
        "//src/main/java/com/google/crypto/tink:registry-android",
        "//src/main/java/com/google/crypto/tink/subtle:elliptic_curves",
    ],
)

android_library(
    name = "hybrid_decrypt_factory-android",
    srcs = ["HybridDecryptFactory.java"],
    deps = [
        ":hybrid_decrypt_wrapper-android",
        "//src/main/java/com/google/crypto/tink:hybrid_decrypt",
        "//src/main/java/com/google/crypto/tink:registry-android",
        "//src/main/java/com/google/crypto/tink:registry_cluster-android",
    ],
)

android_library(
    name = "hybrid_encrypt_factory-android",
    srcs = ["HybridEncryptFactory.java"],
    deps = [
        ":hybrid_encrypt_wrapper-android",
        "//src/main/java/com/google/crypto/tink:hybrid_encrypt",
        "//src/main/java/com/google/crypto/tink:registry-android",
        "//src/main/java/com/google/crypto/tink:registry_cluster-android",
    ],
)

android_library(
    name = "hybrid_encrypt_config-android",
    srcs = ["HybridEncryptConfig.java"],
    deps = [
        ":hybrid_config-android",
        "//src/main/java/com/google/crypto/tink:config-android",
    ],
)
